<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="app">
        <!-- 能在这里使用的只有全局注册的或者挂载在app里注册的 -->
        <cpn2></cpn2>
    </div>
    <script src="../vue.js"></script>
    <script>
        // 子组件
        const cpnC1 = Vue.extend({
            template:`
            <div>
                <h2>header1</h2>
                <p>content,hahhaahah</p>
            </div>`
        })

        // 父组件，里面有components里面包含了cpn1
        const cpnC2 = Vue.extend({
            template:`
            <div>
                <h2>header2</h2>
                <p>content,hehehehe</p>
                <cpn1></cpn1>
            </div>`,
            components:{
                cpn1: cpnC1
            }
        })
        const app = new Vue({
            el: '#app',
            components:{
                cpn2: cpnC2
            }
        })
    </script>
</body>
</html>